/*Replication code for Avdagic, S. and Savage, L. (2019), Negativity Bias: The Impact of Framing of Immigration
 on Welfare State Support in Germany, Sweden and the UK, British Journal of Political Science */

*****************************************************************************************************************************************************
* GERMANY
*****************************************************************************************************************************************************

use bjps_germany_data.dta, replace

set more off



*******************************************************************************

****** Table 1

* Model 1 - Only treatment
ologit redist_support_3 ib3.treatment_group [pweight = w8]

*Model 2 - Interaction with anti-welfare attitudes
* Generate dummy for anti-welfare attitudes 
gen antiwelfare = (antiwelf>3) if !missing(antiwelf)

ologit redist_support_3 ib3.treatment_group##antiwelfare [pweight = w8]

* Model 3 - Interaction with anti-immigrant attitudes
* imputing missing data for antiim2d following Green and Coppock Standard Operating Procedures **
recode antiimm2 (.=3.03421)
recode antiimm1 (.=3.603395)
* Gen dummy for anti-immigrant attitudes
gen antiim2 = (antiimm1 + antiimm2)/2
gen antiim2d = (antiim2>5) if !missing(antiim2)

ologit redist_support_3 ib3.treatment_group##antiim2d [pweight = w8]

* Model 4 - Interaction with concerns about economic insecurity

* Generate economic insecurity dummy
gen welfare_competition = (job==4 | job==5)

ologit redist_support_3 ib3.treatment_group##welfare_competition [pweight = w8]

clear 


************************************************************************************************************
*** SWEDEN
************************************************************************************************************

use bjps_sweden_data.dta, replace

set more off

******** Table 2

* Model 1 
ologit redist_support_3 ib3.treatment_group [pweight = weight]

*Model 2 - Interaction with anti-welfare attitudes
* Generate dummy for anti-welfare attitudes
gen antiwelfare = (antiwelf>3) if !missing(antiwelf)

ologit redist_support_3 ib3.treatment_group##antiwelfare [pweight = weight]


* Model 3 - Interaction with anti-immigrant attitudes
** imputing missing data from antiim2d - following Green and Coppock Standard Operating Procedures **

recode antiimm2 (.=3.3041)
recode antiimm1 (.=4.142037)
* Gen anti-immigrant attitudes dummy
gen antiim2 = (antiimm1 + antiimm2)/2
gen antiim2d = (antiim2>5) if !missing(antiim2)

ologit redist_support_3 ib3.treatment_group##antiim2d [pweight = weight]

* Model 4 - Interaction with economic insecurity
* Generate economic insecurity dummy
gen welfare_competition = (job==4 | job==5)

ologit redist_support_3 ib3.treatment_group##welfare_competition [pweight = weight]

clear


************************************************************************************************************************************
** UK
*************************************************************************************************************************************

use bjps_uk_data.dta, replace

set more off

********** Table 3

* Model 1
ologit redist_support_3 ib3.treatment_group [pweight = W8]

*Model 2 - Interaction with anti-welfare attitudes
*** recode missing data to the overal mean
recode antiwelf (1=5) (2=4) (4=2) (5=1)
 recode antiwelf (.=3.036507)  
* Generate dummy for anti-welfare attitudes
gen antiwelfare = (antiwelf<3) if !missing(antiwelf)

ologit redist_support_3 ib3.treatment_group##antiwelfare [pweight = W8]

* Model 3 - Interaction with anti-immigration attitudes
* recode missing data to the overall mean
recode antiimm1 (.=4.266442)
recode antiimm2 (.=3.485339)

* generate anti-immigrant attitudes dummy
gen antiim2 = (antiimm1 + antiimm2)/2
gen antiim2d = (antiim2>5) if !missing(antiim2)

ologit redist_support_3 ib3.treatment_group##antiim2d  [pweight = W8]


* Model 4 - Interaction with economic insecurity

* Generate economic insecurity dummy
gen welfare_competition = (KCL6==4 | KCL6==5)

ologit redist_support_3 ib3.treatment_group##welfare_competition [pweight = W8]


clear

**************************************************************
*                        Graphs                              *
**************************************************************
** install user written package: grc1leg to combine separate graphs into a single graph with one legend

*** Figure 2
* Ger
use bjps_germany_data.dta
ologit redist_support_3 ib3.treatment_group [pweight = w8]
margins treatment_group, predict(outcome(1)) predict(outcome(3))
marginsplot, recast(scatter) title("Germany") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph main_ger.gph
clear
* Swe
use bjps_sweden_data.dta
ologit redist_support_3 ib3.treatment_group [pweight = weight]
margins treatment_group, predict(outcome(1)) predict(outcome(3))
marginsplot, recast(scatter) title("Sweden") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph main_swe.gph
clear
* UK
use bjps_uk_data.dta
ologit redist_support_3 ib3.treatment_group [pweight = W8]
margins treatment_group, predict(outcome(1)) predict(outcome(3))
marginsplot, recast(scatter) title("United Kingdom") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph main_uk.gph
clear

grc1leg main_ger.gph main_swe.gph main_uk.gph

*** Figure 3
* Ger
use bjps_germany_data.dta
gen antiwelfare = (antiwelf>3) if !missing(antiwelf)
ologit redist_support_3 ib3.treatment_group##antiwelfare [pweight = w8]
margins treatment_group if treatment_group==1 | treatment_group==3 , at(antiwelfare=(0 1)) predict(outcome(1))
marginsplot, recast(scatter) title("Germany") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph antiwelf_ger.gph
clear
* Swe
use bjps_sweden_data.dta
gen antiwelfare = (antiwelf>3) if !missing(antiwelf)
ologit redist_support_3 ib3.treatment_group##antiwelfare [pweight = weight]
margins treatment_group if treatment_group==1 | treatment_group==3 , at(antiwelfare=(0 1)) predict(outcome(1)) 
marginsplot, recast(scatter) title("Sweden") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph antiwelf_swe.gph
clear
* UK
use bjps_uk_data.dta
recode antiwelf (1=5) (2=4) (4=2) (5=1)
recode antiwelf (.=3.036507)  
gen antiwelfare = (antiwelf<3) if !missing(antiwelf)
ologit redist_support_3 ib3.treatment_group##antiwelfare [pweight = W8]
margins treatment_group if treatment_group==1 | treatment_group==3 , at(antiwelfare=(0 1)) predict(outcome(1)) 
marginsplot, recast(scatter) title("United Kingdom") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph antiwelf_uk.gph
clear

grc1leg antiwelf_ger.gph antiwelf_swe.gph antiwelf_uk.gph

*** Figure 4
* Ger
use bjps_germany_data.dta
recode antiimm2 (.=3.03421)
recode antiimm1 (.=3.603395)
gen antiim2 = (antiimm1 + antiimm2)/2
gen antiim2d = (antiim2>5) if !missing(antiim2)
ologit redist_support_3 ib3.treatment_group##antiim2d [pweight = w8]
margins treatment_group if treatment_group==1 | treatment_group==3, at(antiim=(0 1)) predict(outcome(1)) 
marginsplot, recast(scatter) title("Germany") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph antiimm_ger.gph
clear
* SWE
use bjps_sweden_data.dta
recode antiimm2 (.=3.3041)
recode antiimm1 (.=4.142037)
gen antiim2 = (antiimm1 + antiimm2)/2
gen antiim2d = (antiim2>5) if !missing(antiim2)
ologit redist_support_3 ib3.treatment_group##antiim2d [pweight = weight]
margins treatment_group if treatment_group==1 | treatment_group==3, at(antiim=(0 1)) predict(outcome(1)) 
marginsplot, recast(scatter) title("Sweden") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph antiimm_swe.gph
clear
* UK
use bjps_uk_data.dta
recode antiimm1 (.=4.266442)
recode antiimm2 (.=3.485339)
gen antiim2 = (antiimm1 + antiimm2)/2
gen antiim2d = (antiim2>5) if !missing(antiim2)
ologit redist_support_3 ib3.treatment_group##antiim2d [pweight = W8]
margins treatment_group if treatment_group==1 | treatment_group==3, at(antiim=(0 1)) predict(outcome(1)) 
marginsplot, recast(scatter) title("United Kingdom") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph antiimm_uk.gph
clear

grc1leg antiimm_ger.gph antiimm_swe.gph antiimm_uk.gph

*** Figure 5
* Ger
use bjps_germany_data.dta
gen welfare_competition = (job==4 | job==5)
ologit redist_support_3 ib3.treatment_group##welfare_competition [pweight = w8]
margins treatment_group if treatment_group==1 | treatment_group==3 , at(welfare_competition=(0 1)) predict(outcome(1)) 
marginsplot, recast(scatter) title("Germany") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph insec_ger.gph
clear
* Swe
use bjps_sweden_data.dta
gen welfare_competition = (job==4 | job==5)
ologit redist_support_3 ib3.treatment_group##welfare_competition [pweight = weight]
margins treatment_group if treatment_group==1 | treatment_group==3 , at(welfare_competition=(0 1)) predict(outcome(1)) 
marginsplot, recast(scatter) title("Sweden") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph insec_swe.gph
clear
* UK
use bjps_uk_data.dta
gen welfare_competition = (KCL6==4 | KCL6==5)
ologit redist_support_3 ib3.treatment_group##welfare_competition [pweight = W8]
margins treatment_group if treatment_group==1 | treatment_group==3 , at(welfare_competition=(0 1)) predict(outcome(1)) 
marginsplot, recast(scatter) title("United Kingdom") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph insec_uk.gph
clear

grc1leg insec_ger.gph insec_swe.gph insec_uk.gph


************************************************************
*                      APPENDIX                            *
************************************************************

* Table A1

* Ger A1.1
use bjps_germany_data.dta
ologit redist_support_3 ib3.treatment_group i.age i.sex i.education2 i.work_status i.past_vote2013 [pweight = w8]
clear
*Swe A1.2
use bjps_sweden_data.dta
rename profile_work_stat_1 working_full_time
rename profile_work_stat_2 working_pt_8_29_hours
rename profile_work_stat_3 working_pt_less_than_8_hours
rename profile_work_stat_4 studying
rename profile_work_stat_5 pensioner
rename profile_work_stat_6 seeking_work
rename profile_work_stat_7 does_not_work_at_all
ologit redist_support_3 ib3.treatment_group age i.gender i.profile_education i.working_full_time i.working_pt_8_29_hours i.working_pt_less_than_8_hours ///
i.studying i.pensioner i.seeking_work  i.does_not_work_at_all i.FT14 [pweight = weight]
clear
* UK A1.3
use bjps_uk_data.dta
ologit redist_support_3 ib3.treatment_group Age i.Gender i.Education_Level i.Work_Status i.PastVote_2017 [pweight = W8]
clear

* Table A2

*Bonferroni-adjusted p-values and confidence intervals - pairwise comparisons

* UK
use bjps_uk_data.dta
ologit redist_support_3 ib3.treatment_group [pweight = W8]
pwcompare treatment_group, effects mcompare(bonferroni)
clear

*Germany
use bjps_germany_data.dta
ologit redist_support_3 ib3.treatment_group [pweight = w8]
pwcompare treatment_group, effects mcompare(bonferroni)
clear

* Sweden
use bjps_sweden_data.dta
ologit redist_support_3 ib3.treatment_group [pweight = weight]
pwcompare treatment_group, effects mcompare(bonferroni)
clear

* Table A4 - Germany
use bjps_germany_data.dta
set seed 54267

* equals sample size of Swedish survey
sample 48.12, by(treatment_group)

* Model 1 - Only treatment
ologit redist_support_3 ib3.treatment_group [pweight = w8]

*Model 2 - Interaction with anti-welfare attitudes
* Generate dummy for anti-welfare attitudes 
gen antiwelfare = (antiwelf>3) if !missing(antiwelf)
ologit redist_support_3 ib3.treatment_group##antiwelfare [pweight = w8]

* Model 3 - Interaction with anti-immigrant attitudes
*** imputing missing data for antiim2d following Green and Coppock Standard Operating Procedures **
recode antiimm2 (.=3.03421)
recode antiimm1 (.=3.603395)
* Gen dummy for anti-immigrant attitudes
gen antiim2 = (antiimm1 + antiimm2)/2
gen antiim2d = (antiim2>5) if !missing(antiim2)
ologit redist_support_3 ib3.treatment_group##antiim2d [pweight = w8]

* Model 4 - Interaction with economic insecurity
* Generate economic insecurity dummy
gen welfare_competition = (job==4 | job==5)
ologit redist_support_3 ib3.treatment_group##welfare_competition [pweight = w8]

clear

**  Table A5 - UK
use bjps_uk_data.dta
set seed 5973

* equals sample size of Swedish survey
sample 61.21, by(treatment_group)

* Model 1 - Only treatment
ologit redist_support_3 ib3.treatment_group [pweight = W8]

*Model 2 - Interaction with anti-welfare attitudes
*** recode missing data to the overal mean
recode antiwelf (1=5) (2=4) (4=2) (5=1)
 recode antiwelf (.=3.036507)  
* Generate dummy for anti-welfare attitudes
gen antiwelfare = (antiwelf<3) if !missing(antiwelf)
ologit redist_support_3 ib3.treatment_group##antiwelfare [pweight = W8]

* Model 3 - Interaction with anti-immigrant attitudes
* recode missing data to the overall mean
recode antiimm1 (.=4.266442)
recode antiimm2 (.=3.485339)

* generate a dummy for anti-immigrant attitudes
gen antiim2 = (antiimm1 + antiimm2)/2
gen antiim2d = (antiim2>5) if !missing(antiim2)
ologit redist_support_3 ib3.treatment_group##antiim2d  [pweight = W8]

* Model 4 - Interaction with economic insecurity

* Generate economic insecurity dummy 
gen welfare_competition = (KCL6==4 | KCL6==5)
ologit redist_support_3 ib3.treatment_group##welfare_competition [pweight = W8]
clear


**** Table A12
* Germany
use bjps_germany_data.dta

encode newspaper_read_12_months__1, gen (newspaper_1)
encode newspaper_read_12_months__2, gen (newspaper_2)
recode newspaper_1 newspaper_2 (1=.) (2=0) (3=1)
label define newspaper_1 0 "0" 1 "1", modify
label values newspaper_1

label define newspaper_2 0 "0" 1 "1", modify
label values newspaper_2

egen antiimm_paper = rowmax(newspaper_1 newspaper_2)
tab antiimm_paper

ologit redist_support_3 ib3.treatment_group##antiimm_paper [pweight = w8]
clear

* Sweden
use bjps_sweden_data.dta

encode read_expressen, gen (read_expressen1)
encode read_goteborgs_posten, gen (read_goteborgs_posten1)
encode read_svenska_dagbladet, gen (read_svenska_dagbladet1)

ologit redist_support_3 ib3.treatment read_expressen1 read_goteborgs_posten1 read_svenska_dagbladet1 ib3.treatment_group#c.read_expressen1 ib3.treatment_group#c.read_goteborgs_posten1 ib3.treatment_group#c.read_svenska_dagbladet1 [pweight = weight]
clear

* UK
use bjps_uk_data.dta

gen antiim_papers = 0
replace antiim_papers = 1 if Newspaper_Readership ==1 | Newspaper_Readership==2 | Newspaper_Readership==4 | Newspaper_Readership==5
tab antiim_papers treatment_group
tab antiim_papers redist_support_3

ologit redist_support_3 ib3.treatment_group##antiim_papers [pweight = W8]
clear
 
 
** marginal effects graphs

* Figure A1
* Ger
use bjps_germany_data.dta
ologit redist_support_3 ib3.treatment_group [pweight = w8]
margins, dydx(treatment_group) predict(outcome(1)) predict(outcome(3))
marginsplot, recast(scatter) title("Germany") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph main_ger_mfx.gph
clear
* Swe
use bjps_sweden_data.dta
ologit redist_support_3 ib3.treatment_group [pweight = weight]
margins, dydx(treatment_group) predict(outcome(1)) predict(outcome(3))
marginsplot, recast(scatter) title("Sweden") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph main_swe_mfx.gph
clear
* UK
use bjps_uk_data.dta
ologit redist_support_3 ib3.treatment_group [pweight = W8]
margins, dydx(treatment_group) predict(outcome(1)) predict(outcome(3))
marginsplot, recast(scatter) title("United Kingdom") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph main_uk_mfx.gph
clear

grc1leg main_ger_mfx.gph main_swe_mfx.gph main_uk_mfx.gph

*** Figure A2
* Ger
use bjps_germany_data.dta
gen antiwelfare = (antiwelf>3) if !missing(antiwelf)
ologit redist_support_3 ib3.treatment_group##antiwelfare [pweight = w8]
margins, dydx(treatment_group) at(antiwelfare=(0 1)) predict(outcome(1))
marginsplot, recast(scatter) title("Germany") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph antiwelf_ger.gph
clear
* Swe
use bjps_sweden_data.dta
gen antiwelfare = (antiwelf>3) if !missing(antiwelf)
ologit redist_support_3 ib3.treatment_group##antiwelfare [pweight = weight]
margins, dydx(treatment_group) at(antiwelfare=(0 1)) predict(outcome(1)) 
marginsplot, recast(scatter) title("Sweden") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph antiwelf_swe.gph
clear
* UK
use bjps_uk_data.dta
recode antiwelf (1=5) (2=4) (4=2) (5=1)
recode antiwelf (.=3.036507)   
gen antiwelfare = (antiwelf<3) if !missing(antiwelf)
ologit redist_support_3 ib3.treatment_group##antiwelfare [pweight = W8]
margins, dydx(treatment_group) at(antiwelfare=(0 1)) predict(outcome(1)) 
marginsplot, recast(scatter) title("United Kingdom") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph antiwelf_uk.gph
clear

grc1leg antiwelf_ger.gph antiwelf_swe.gph antiwelf_uk.gph

*** Figure A3
* Ger
use bjps_germany_data.dta
recode antiimm2 (.=3.03421)
recode antiimm1 (.=3.603395)
gen antiim2 = (antiimm1 + antiimm2)/2
gen antiim2d = (antiim2>5) if !missing(antiim2)
ologit redist_support_3 ib3.treatment_group##antiim2d [pweight = w8]
margins, dydx(treatment_group) at(antiim=(0 1)) predict(outcome(1)) 
marginsplot, recast(scatter) title("Germany") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph antiimm_ger_mfx.gph
clear
* SWE
use bjps_sweden_data.dta
recode antiimm2 (.=3.3041)
recode antiimm1 (.=4.142037)
gen antiim2 = (antiimm1 + antiimm2)/2
gen antiim2d = (antiim2>5) if !missing(antiim2)
ologit redist_support_3 ib3.treatment_group##antiim2d [pweight = weight]
margins, dydx(treatment_group) at(antiim=(0 1)) predict(outcome(1)) 
marginsplot, recast(scatter) title("Sweden") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph antiimm_swe_mfx.gph
clear
* UK
use bjps_uk_data.dta
recode antiimm1 (.=4.266442)
recode antiimm2 (.=3.485339)
gen antiim2 = (antiimm1 + antiimm2)/2
gen antiim2d = (antiim2>5) if !missing(antiim2)
ologit redist_support_3 ib3.treatment_group##antiim2d [pweight = W8]
margins, dydx(treatment_group) at(antiim=(0 1)) predict(outcome(1)) 
marginsplot, recast(scatter) title("United Kingdom") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph antiimm_uk_mfx.gph
clear

grc1leg antiimm_ger_mfx.gph antiimm_swe_mfx.gph antiimm_uk_mfx.gph

*** Figure A4
* Ger
use bjps_germany_data.dta
gen welfare_competition = (job==4 | job==5)
ologit redist_support_3 ib3.treatment_group##welfare_competition [pweight = w8]
margins, dydx(treatment_group) at(welfare_competition=(0 1)) predict(outcome(1)) 
marginsplot, recast(scatter) title("Germany") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph insec_ger_mfx.gph
clear
* Swe
use bjps_sweden_data.dta
gen welfare_competition = (job==4 | job==5)
ologit redist_support_3 ib3.treatment_group##welfare_competition [pweight = weight]
margins, dydx(treatment_group) at(welfare_competition=(0 1)) predict(outcome(1)) 
marginsplot, recast(scatter) title("Sweden") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph insec_swe_mfx.gph
clear
* UK
use bjps_uk_data.dta
gen welfare_competition = (KCL6==4 | KCL6==5)
ologit redist_support_3 ib3.treatment_group##welfare_competition [pweight = W8]
margins, dydx(treatment_group) at(welfare_competition=(0 1)) predict(outcome(1)) 
marginsplot, recast(scatter) title("United Kingdom") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph insec_uk_mfx.gph
clear

grc1leg insec_ger_mfx.gph insec_swe_mfx.gph insec_uk_mfx.gph

* Positive treatment group graphs
* Figure A5
* Ger
use bjps_germany_data.dta
gen antiwelfare = (antiwelf>3) if !missing(antiwelf)
ologit redist_support_3 ib3.treatment_group##antiwelfare [pweight = w8]
margins treatment_group if treatment_group==2 | treatment_group==3 , at(antiwelfare=(0 1)) predict(outcome(1))
marginsplot, recast(scatter) title("Germany") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph antiwelf_ger_pos.gph
clear
* Swe
use bjps_sweden_data.dta
gen antiwelfare = (antiwelf>3) if !missing(antiwelf)
ologit redist_support_3 ib3.treatment_group##antiwelfare [pweight = weight]
margins treatment_group if treatment_group==2 | treatment_group==3 , at(antiwelfare=(0 1)) predict(outcome(1)) 
marginsplot, recast(scatter) title("Sweden") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph antiwelf_swe_pos.gph
clear
* UK
use bjps_uk_data.dta
recode antiwelf (1=5) (2=4) (4=2) (5=1)
recode antiwelf (.=3.036507)  
gen antiwelfare = (antiwelf<3) if !missing(antiwelf)
ologit redist_support_3 ib3.treatment_group##antiwelfare [pweight = W8]
margins treatment_group if treatment_group==2 | treatment_group==3 , at(antiwelfare=(0 1)) predict(outcome(1)) 
marginsplot, recast(scatter) title("United Kingdom") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph antiwelf_uk_pos.gph
clear

grc1leg antiwelf_ger_pos.gph antiwelf_swe_pos.gph antiwelf_uk_pos.gph

*** Figure A6
* Ger
use bjps_germany_data.dta
recode antiimm2 (.=3.03421)
recode antiimm1 (.=3.603395)
gen antiim2 = (antiimm1 + antiimm2)/2
gen antiim2d = (antiim2>5) if !missing(antiim2)
ologit redist_support_3 ib3.treatment_group##antiim2d [pweight = w8]
margins treatment_group if treatment_group==2 | treatment_group==3, at(antiim=(0 1)) predict(outcome(1)) 
marginsplot, recast(scatter) title("Germany") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph antiimm_ger_pos.gph
clear
* SWE
use bjps_sweden_data.dta
recode antiimm2 (.=3.3041)
recode antiimm1 (.=4.142037)
gen antiim2 = (antiimm1 + antiimm2)/2
gen antiim2d = (antiim2>5) if !missing(antiim2)
ologit redist_support_3 ib3.treatment_group##antiim2d [pweight = weight]
margins treatment_group if treatment_group==2 | treatment_group==3, at(antiim=(0 1)) predict(outcome(1)) 
marginsplot, recast(scatter) title("Sweden") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph antiimm_swe_pos.gph
clear
* UK
use bjps_uk_data.dta
recode antiimm1 (.=4.266442)
recode antiimm2 (.=3.485339)
gen antiim2 = (antiimm1 + antiimm2)/2
gen antiim2d = (antiim2>5) if !missing(antiim2)
ologit redist_support_3 ib3.treatment_group##antiim2d [pweight = W8]
margins treatment_group if treatment_group==2 | treatment_group==3, at(antiim=(0 1)) predict(outcome(1)) 
marginsplot, recast(scatter) title("United Kingdom") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph antiimm_uk_pos.gph
clear

grc1leg antiimm_ger_pos.gph antiimm_swe_pos.gph antiimm_uk_pos.gph

*** Figure A7
* Ger
use bjps_germany_data.dta
gen welfare_competition = (job==4 | job==5)
ologit redist_support_3 ib3.treatment_group##welfare_competition [pweight = w8]
margins treatment_group if treatment_group==2 | treatment_group==3 , at(welfare_competition=(0 1)) predict(outcome(1)) 
marginsplot, recast(scatter) title("Germany") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph insec_ger_pos.gph
clear
* Swe
use bjps_sweden_data.dta
gen welfare_competition = (job==4 | job==5)
ologit redist_support_3 ib3.treatment_group##welfare_competition [pweight = weight]
margins treatment_group if treatment_group==2 | treatment_group==3 , at(welfare_competition=(0 1)) predict(outcome(1)) 
marginsplot, recast(scatter) title("Sweden") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph insec_swe_pos.gph
clear
* UK
use bjps_uk_data.dta
gen welfare_competition = (KCL6==4 | KCL6==5)
ologit redist_support_3 ib3.treatment_group##welfare_competition [pweight = W8]
margins treatment_group if treatment_group==2 | treatment_group==3 , at(welfare_competition=(0 1)) predict(outcome(1)) 
marginsplot, recast(scatter) title("United Kingdom") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph insec_uk_pos.gph
clear

grc1leg insec_ger_pos.gph insec_swe_pos.gph insec_uk_pos.gph


*** Figure A8
* Ger
use bjps_germany_data.dta
ologit redist_support_3 ib3.treatment_group##antiwelf [pweight = w8]
margins treatment_group if treatment_group==1 | treatment_group==3 , at(antiwelf=(1(1)5)) predict(outcome(1))
marginsplot, recast(scatter) title("Germany") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph antiwelf_ger_orig.gph
clear
* Swe
use bjps_sweden_data.dta
ologit redist_support_3 ib3.treatment_group##antiwelf [pweight = weight]
margins treatment_group if treatment_group==1 | treatment_group==3 , at(antiwelf=(1(1)5)) predict(outcome(1)) 
marginsplot, recast(scatter) title("Sweden") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph antiwelf_swe_orig.gph
clear
* UK
use bjps_uk_data.dta
recode antiwelf (.=3.036507)  
ologit redist_support_3 ib3.treatment_group##c.antiwelf [pweight = W8]
margins treatment_group if treatment_group==1 | treatment_group==3 , at(antiwelf=(1(1)5)) predict(outcome(1)) 
marginsplot, recast(scatter) title("United Kingdom") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph antiwelf_uk_orig.gph
clear

grc1leg antiwelf_ger_orig.gph antiwelf_swe_orig.gph antiwelf_uk_orig.gph

*** Figure A9
* Ger
use bjps_germany_data.dta
recode antiimm2 (.=3.03421)
recode antiimm1 (.=3.603395)
gen antiim2 = (antiimm1 + antiimm2)/2
ologit redist_support_3 ib3.treatment_group##c.antiimm2 [pweight = w8]
margins treatment_group if treatment_group==1 | treatment_group==3, at(antiimm2=(1(1)10)) predict(outcome(1)) 
marginsplot, recast(scatter) title("Germany") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph antiimm_ger_orig.gph
clear
* SWE
use bjps_sweden_data.dta
recode antiimm2 (.=3.3041)
recode antiimm1 (.=4.142037)
gen antiim2 = (antiimm1 + antiimm2)/2
ologit redist_support_3 ib3.treatment_group##c.antiimm2 [pweight = weight]
margins treatment_group if treatment_group==1 | treatment_group==3, at(antiimm2=(1(1)10)) predict(outcome(1)) 
marginsplot, recast(scatter) title("Sweden") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph antiimm_swe_orig.gph
clear
* UK
use bjps_uk_data.dta
recode antiimm1 (.=4.266442)
recode antiimm2 (.=3.485339)
gen antiim2 = (antiimm1 + antiimm2)/2
ologit redist_support_3 ib3.treatment_group##c.antiimm2 [pweight = W8]
margins treatment_group if treatment_group==1 | treatment_group==3, at(antiimm2=(1(1)10)) predict(outcome(1)) 
marginsplot, recast(scatter) title("United Kingdom") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph antiimm_uk_orig.gph
clear

grc1leg antiimm_ger_orig.gph antiimm_swe_orig.gph antiimm_uk_orig.gph

*** Figure A10
* Ger
use bjps_germany_data.dta
ologit redist_support_3 ib3.treatment_group##job [pweight = w8]
margins treatment_group if treatment_group==1 | treatment_group==3 , at(job=(1(1)5)) predict(outcome(1)) 
marginsplot, recast(scatter) title("Germany") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph insec_ger_orig.gph
clear
* Swe
use bjps_sweden_data.dta
ologit redist_support_3 ib3.treatment_group##job [pweight = weight]
margins treatment_group if treatment_group==1 | treatment_group==3 , at(job=(1(1)5)) predict(outcome(1)) 
marginsplot, recast(scatter) title("Sweden") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph insec_swe_orig.gph
clear
* UK
use bjps_uk_data.dta
ologit redist_support_3 ib3.treatment_group##KCL6 [pweight = W8]
margins treatment_group if treatment_group==1 | treatment_group==3 , at(KCL6=(1(1)5)) predict(outcome(1)) 
marginsplot, recast(scatter) title("United Kingdom") ytitle("Predicted probability") ysize(6) xsize(6) legend(position(6) c(2))
graph save Graph insec_uk_orig.gph
clear

grc1leg insec_ger_orig.gph insec_swe_orig.gph insec_uk_orig.gph
